#ifndef TESTCASESDLG_H
#define TESTCASESDLG_H

#include <wx/sizer.h>
#include <wx/button.h>
#include "scrollingdialog.h"
#include <wx/timer.h>
#include <wx/listbox.h>
#include <wx/thread.h>

#include "TestCasesBase.h"

class TestCasesDlg: public wxScrollingDialog, public TestCasesBase::Output {
  public:

    TestCasesDlg( wxWindow* parent, TestCasesBase& tests );
    virtual ~TestCasesDlg();

  protected:

    virtual void AddLog( const wxString& logLine );
    virtual bool StopTest();

  private:


    wxListBox* ListBox1;
    wxButton* Button1;
    wxTimer Timer1;



    static const long ID_LISTBOX1;
    static const long ID_BUTTON1;
    static const long ID_TIMER1;



    void OnButton1Click( wxCommandEvent& event );
    void OnTimer1Trigger( wxTimerEvent& event );
    void OnClose( wxCloseEvent& event );


    virtual int Entry();

    void BuildContent( wxWindow* parent );

    class MyThread: public wxThread {
      public:

        MyThread( TestCasesDlg* dlg ): wxThread( wxTHREAD_JOINABLE ), m_Dlg( dlg ) {}

      private:

        TestCasesDlg* m_Dlg;

        virtual ExitCode Entry() { return reinterpret_cast<ExitCode>( m_Dlg->Entry() ); }
    };

    TestCasesBase&    m_Tests;
    MyThread*         m_Thread;
    wxCriticalSection m_Section;
    wxArrayString     m_NewLogs;
    bool              m_Running;
    bool              m_StopRequest;
    bool              m_Result;
    bool              m_BtnChanged;

    DECLARE_EVENT_TABLE()
};

#endif
